package com.sinosoft.msf.base.supplier.controller;


import com.sinosoft.msf.base.supplier.pojo.RestEntity;
import com.sinosoft.msf.base.supplier.pojo.entity.SCompanyUserRole;
import com.sinosoft.msf.base.supplier.pojo.OptVo;
import com.sinosoft.msf.base.supplier.service.CommonBizService;
import com.sinosoft.msf.base.supplier.service.CompanyUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/companyUserRole")
public class CompanyUserRoleController {
    @Autowired
    CompanyUserRoleService companyUserRoleService;
    @Autowired
    CommonBizService bizService;
    private OptVo curentOpt() {
        return bizService.queryCureUserInfo();
    }

    @PostMapping("/queryRole")
    public RestEntity queryRole() {
        OptVo optVo = curentOpt();
        return RestEntity.data(companyUserRoleService.queryRole(optVo));
    }

    @PostMapping("/addRole")
    public RestEntity addRole(@RequestBody SCompanyUserRole userRole) {
        OptVo optVo = curentOpt();
        return RestEntity.data(companyUserRoleService.addRole(userRole));
    }
    @PostMapping("/delRole")
    public RestEntity delRole(@RequestBody SCompanyUserRole userRole) {
        OptVo optVo = curentOpt();
        return RestEntity.data(companyUserRoleService.delRole(userRole));
    }

}
